//
//  MCVerticalButton.swift
//  SwiftProject
//
//  Created by goulela on 2017/8/8.
//  Copyright © 2017年 MC. All rights reserved.
//

import UIKit

// 纵向
class MCVerticalButton: UIButton {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpSubViews()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    func setUpSubViews() {
        
        self.addSubview(nameLabel)
        nameLabel.snp.updateConstraints { (make) -> Void in
            make.centerX.equalTo(self)
            make.bottom.equalTo(self).offset(-5)
        }
        
        self.addSubview(iconImageView)
        iconImageView.snp.updateConstraints { (make) -> Void in
            make.centerX.equalTo(self)
            make.top.equalTo(self).offset(5)
        }
        
        self.addSubview(promptLabel)
        promptLabel.snp.updateConstraints { (make) -> Void in
            make.right.equalTo(iconImageView.snp.right).offset(3.5)
            make.top.equalTo(iconImageView.snp.top).offset(-5.5)
            make.size.equalTo(CGSize.init(width: 15, height: 15))
        }
        
    }
    
    public lazy var iconImageView: UIImageView = {
        let iconImageView = UIImageView.init()
        
        return iconImageView
    }()
    
    public lazy var nameLabel: UILabel = {
        let nameLabel = UILabel.init()
        nameLabel.font = MCFont(12)
        nameLabel.textColor = UIColor.MCBlack
        
        return nameLabel
    }()
    
    
    lazy public var promptLabel: UILabel = {
        let promptLabel = UILabel.init()
        promptLabel.font = MCFont(10)
        promptLabel.textColor = UIColor.white
        promptLabel.backgroundColor = UIColor.MCRed
        promptLabel.layer.cornerRadius = 7.5
        promptLabel.layer.masksToBounds = true
        promptLabel.textAlignment = NSTextAlignment.center
        promptLabel.isHidden = true
        
        return promptLabel
    }()
}




